import axios from '../utils'

const api = {
    getById: '/ssp/getById', //查询单个ssp
    getAllDataByPage: '/ssp/getAllDataByPage', //分页查询ssp
    edit: '/ssp', //修改,添加,查詢

    getBidder: '/bidder', //查询所有的bidder 返回name数组
    getByName: '/bidder/getByName', //查看bidder的详细数据
    startBid: '/bidder/start', //启动投标
    stopBid: '/bidder/stop', //停止投标

    change_state: '/ssp/change_state', //开启/关闭

};

//查詢所有SSP
export function getAllSSP() {
    return axios.get(api.edit)
}

export function getAllDataByPage(params) {
    return axios.get(api.getAllDataByPage, {
        params
    });
}

export function getById(id) {
    return axios.get(api.getById + `/${id}`);
}


export function editSSP(params) {
    return axios.put(api.edit, params);
}

export function addSSP(params) {
    return axios.post(api.edit, params);
}

export function getAllBidder() {
    return axios.get(api.getBidder)
}

export function getByNameBidder(name) {
    return axios.get(api.getByName + `/${name}`)
}

export function startBid(name) {
    return axios.get(api.startBid + `/${name}`)
}

export function stopBid(name) {
    return axios.get(api.stopBid + `/${name}`)
}

//开启关闭
export function changeState(params) {
    return axios.get(api.change_state, {
        params
    })
}

